package com.qiyuexinxi.chat.controller;

import com.qiyuexinxi.chat.common.GenericResponse;
import com.qiyuexinxi.chat.constants.api.UserApi;
import com.qiyuexinxi.chat.dto.request.GetUserCityListRequest;
import com.qiyuexinxi.chat.dto.request.GetUserInfoRequest;
import com.qiyuexinxi.chat.dto.request.GetUserListRequest;
import com.qiyuexinxi.chat.service.impl.UserActiveServiceImpl;
import com.qiyuexinxi.chat.service.impl.UserCityServiceImpl;
import com.qiyuexinxi.chat.service.impl.UserNewServiceImpl;
import com.qiyuexinxi.chat.service.impl.UserRecommendServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author yangxingyu
 * @date 2020/3/28
 * @description
 */
@RestController
@Api(description = "用户列表")
public class UserListController {

    @Autowired
    UserActiveServiceImpl userActiveService;
    @Autowired
    UserNewServiceImpl userNewService;
    @Autowired
    UserRecommendServiceImpl userRecommendService;
    @Autowired
    UserCityServiceImpl userCityService;

    @GetMapping(value = UserApi.GET_USER_RECOMMEND, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取推荐用户列表", notes = "获取推荐用户列表")
    public GenericResponse getUserRecommend(@Valid GetUserListRequest getUserListRequest){
        return new GenericResponse(userRecommendService.getUserRecommend(getUserListRequest));
    }

    @GetMapping(value = UserApi.GET_USER_NEW, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取新人用户列表", notes = "获取新人用户列表")
    public GenericResponse getUserNew(@Valid GetUserListRequest getUserListRequest){
        return new GenericResponse(userNewService.getUserNew(getUserListRequest));
    }

    @GetMapping(value = UserApi.GET_USER_ACTIVE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取活跃用户列表", notes = "获取活跃用户列表")
    public GenericResponse getUserActive(@Valid GetUserListRequest getUserListRequest){
        return new GenericResponse(userActiveService.getUserActive(getUserListRequest));
    }

    @GetMapping(value = UserApi.GET_USER_CITY, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取城市用户列表", notes = "获取城市用户列表")
    public GenericResponse getUserCity(@Valid GetUserCityListRequest getUserCityListRequest){
        return new GenericResponse(userCityService.getUserCity(getUserCityListRequest));
    }
}
